package com.naizhuai.Model.db.user;
import com.naizhuai.network.apistore.UserManageDataApiStore;
import com.naizhuai.ui.user.UserManageDataApiStoreIml;
import rx.Observer;

/**
 * @author：lichenxi
 * @date 2018/2/28 10
 * email：525603977@qq.com
 * Fighting
 */
public class RemoteUserData implements UserDataSourse {
    private UserManageDataApiStore mUserApiStore;

    public RemoteUserData() {
        mUserApiStore=new UserManageDataApiStoreIml();
    }

    @Override
    public void getUserByPhone(String phone,GetUserCallback callback) {

    }

    @Override
    public void saveUser(PersonUserBean user) {

    }

    @Override
    public PersonUserBean getUserSyn(String uid) {
        return null;
    }

    @Override
    public void getUserAsyn(String uid, GetUserCallback callback) {

    }

    @Override
    public void updateLoginUser(GetUserCallback callback) {
        mUserApiStore.getuserinfo().subscribe(new Observer<PersonUserBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                callback.onDataNotAvailable();
            }

            @Override
            public void onNext(PersonUserBean userBean) {
                callback.onUserLoaded(userBean);
            }
        });
    }
}
